package com.yiwyn.demo.publish;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.stereotype.Component;

@Component
public class RedisMQPublish {

    @Autowired
    private ChannelTopic channelTopic;

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;


    public void publishMsg(String message) {
        redisTemplate.convertAndSend(channelTopic.getTopic(), message);
    }

}
